{% from "layout/errorlist.html" import errorlist %}

{% macro login_form(form, next_url='', action=None) -%}
  <form method="post" action="{{ action if action != None else url('users.login') }}">
    {{ errorlist(form) }}
    {% csrf_token %}
    <input type="hidden" name="next" value="{{ next_url }}" />
    <fieldset>
      <div>
        <label>{{ _('Username') }}</label>
        {{ form.username|safe }}
      </div>
      <div>
        <label>{{ _('Password') }}</label>
        {{ form.password|safe }}
      </div>
    </fieldset>
    <div class="submit">
      <button type="submit" data-type="submit" data-name="login" class="btn btn-submit" data-progress="{{ _('Signing in...') }}" data-done="{{ _('Signed in!') }}" data-reset="{{ _('Sign in') }}">{{ _('Sign in') }}</button>
     <a class="btn" href="{{ url('users.fxa_authentication_init') }}">{{ _("Don't have an account? Register") }} </a>
    </div>
    <ul class="login-help">
      <li><a href="{{ url('users.pw_reset') }}">{{ _("My password isn't working.") }}</a></li>
      <li><a href="{{ url('users.forgot_username') }}">{{ _('I forgot my username.') }}</a></li>
      <li><a href="{{ url('users.resend_confirmation') }}">{{ _("I didn't get a confirmation email.") }}</a></li>
    </ul>
  </form>
{%- endmacro %}

